package com.learn.jdk8.lambda05;

import java.util.function.Supplier;

public class Test {

    private static String newString(Supplier<String> supplier){
        return supplier.get();
    }

    private static Integer getMax(Supplier<Integer> supplier){
        return supplier.get();
    }

    public static void main(String[] args) {
        String str1 = newString(()->{
            return "当归";
        });

        String str2 = newString(new Supplier<String>() {
            @Override
            public String get() {
                return "深圳";
            }
        });

        String str3 = newString(()->"ヾ(◍°∇°◍)ﾉﾞ加油");

        System.out.println(str1);
        System.out.println(str2);
        System.out.println(str3);

        int[] arr = {1,2,33,5,2,666,7779,7,83,6,9,87,8,7,22};
        int max = getMax(()->{
           int rtn = arr[0];
            for (int i:arr) {
                if(i>rtn){
                    rtn = i;
                }
            }
            return rtn;
        });

        System.out.println(max);

    }
}
